// Copyright (c) 2009 Luca Marrocco.
// Modified or written by Luca Marrocco for inclusion with codej.
// Licensed under the Apache License, Version 2.0 (the "License")
package codej.ast;

import java.math.*;

import codej.ast.*;

public class NumberExpression extends Expression {

	private BigDecimal num;

	public NumberExpression(BigDecimal num) {
		this.num = num;
	}

	public void accept(Visitor visitor) {
		visitor.visit(this);
	}

	@Override
	public boolean equals(Object obj) {
		if (!obj.getClass().isAssignableFrom(NumberExpression.class))
			return false;
		NumberExpression anotherNumberExpression = (NumberExpression) obj;
		if (!num.equals(anotherNumberExpression.num))
			return false;
		return true;
	}

	public BigDecimal getNum() {
		return num;
	}

	@Override
	public String toString() {
		return num.toPlainString();
	}

}
